home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / QuickDraw GX / QuickDraw GX Info / QuickDraw GX Interfaces / Interfaces & Libraries / interfaces / selection library.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-30  |  3.5 KB  |  126 lines  |  [TEXT/MPS ]

  1. /* graphics libraries:
  2.     layout library interface: Routines to manipulate Selection objects
  3.   by Dave Opstad, Eric Mader
  4.     Copyright 1991 - 1993 Apple Computer, Inc.  All rights reserved. */
  5.  
  6. #pragma once
  7. #ifndef selectionLibraryIncludes
  8.     #define selectionLibraryIncludes
  9.     
  10.     #ifndef layoutTypesIncludes
  11.     #include "layout types.h"
  12.     #endif
  13.     
  14.     #ifndef graphicsTypesIncludes
  15.     #include "graphics types.h"
  16.     #endif
  17.     
  18.     #ifdef __cplusplus
  19.     extern "C" {
  20.     #endif
  21.     
  22.     /* Constants and Enumerations */
  23.     
  24.     #define selectionExtremeEdge -1
  25.     
  26.     enum SelectionTypes {
  27.       emptySelection,
  28.       simpleCaret,
  29.       simpleRange,
  30.       discontiguousRange
  31.     };
  32.     typedef unsigned short SelectionType;
  33.     
  34.     enum SelectionMatches {
  35.       notInSelection,
  36.       partlyInSelection,
  37.       fullyInSelection,
  38.       equalToSelection
  39.     };
  40.     typedef unsigned short SelectionMatch;
  41.     
  42.     /* Types and Structures */
  43.     
  44.     typedef long SelectionOffset;
  45.     
  46.     struct SelectionOffsetRange {
  47.       SelectionOffset minOffset;  /* earliest char */
  48.       SelectionOffset maxOffset;  /* latest char */
  49.     };
  50.     
  51.     struct SelectionRanges {
  52.       long                                                    rangeCount;
  53.       struct SelectionOffsetRange        ranges[gxAnyNumber];
  54.     };
  55.     
  56.     struct CaretPiece {
  57.       SelectionOffset                                offset;
  58.       short                                                    leadingEdge;
  59.     };
  60.     
  61.     struct Selection {
  62.          SelectionType                                    type;
  63.       union {
  64.         struct CaretPiece                        caret;
  65.         struct SelectionRanges            range;
  66.         } data;
  67.     };
  68.     
  69.     typedef struct Selection* SelectionPtr, ** SelectionHandle;
  70.     
  71.     #ifndef __cplusplus
  72.         typedef struct SelectionOffsetRange SelectionOffsetRange;
  73.         typedef struct SelectionRanges SelectionRanges;
  74.         typedef struct CaretPiece CaretPiece;
  75.         typedef struct Selection Selection;
  76.     #endif
  77.     
  78.     /* Routines */
  79.     
  80.     SelectionHandle NewEmptySelection(void);
  81.     SelectionHandle NewCaretSelection(SelectionOffset offset, long leadingEdge);
  82.     SelectionHandle NewRangeSelection(SelectionOffsetRange *range);
  83.     
  84.     SelectionHandle NewFullSelection(void);
  85.     SelectionHandle NewStartSelection(SelectionOffset toOffset);
  86.     SelectionHandle NewEndSelection(SelectionOffset fromOffset);
  87.     
  88.     void SetEmptySelection(SelectionHandle selection);
  89.     void SetCaretSelection(SelectionHandle selection, SelectionOffset offset, long leadingEdge);
  90.     void SetRangeSelection(SelectionHandle selection, SelectionOffsetRange *range);
  91.     
  92.     void SetFullSelection(SelectionHandle selection);
  93.     void SetStartSelection(SelectionHandle selection, SelectionOffset toOffset);
  94.     void SetEndSelection(SelectionHandle selection, SelectionOffset fromOffset);
  95.     
  96.     void DisposeSelection(SelectionHandle selection);
  97.     
  98.     SelectionType GetSelectionType(SelectionHandle selection);
  99.     
  100.     SelectionOffset GetCaretSelection(SelectionHandle selection, boolean *leadingEdge);
  101.     long GetRangeSelection(SelectionHandle selection, SelectionRanges *selectionRanges);
  102.     
  103.     SelectionMatch RangeInSelection(SelectionHandle selection, SelectionOffsetRange *range);
  104.     
  105.     void InvertSelection(SelectionHandle dest);
  106.     void ShiftSelection(SelectionHandle dest, SelectionOffset delta);
  107.     
  108.     void UnionSelection(SelectionHandle dest, SelectionHandle source);
  109.     void SectSelection(SelectionHandle dest, SelectionHandle source);
  110.     void XorSelection(SelectionHandle dest, SelectionHandle source);
  111.     void DiffSelection(SelectionHandle dest, SelectionHandle source);
  112.     
  113.     gxShape GetLayoutSelection(
  114.       gxShape           layout,
  115.       SelectionHandle selection,
  116.       SelectionOffset lineStart,
  117.       gxHighlightType   highlightType,
  118.       gxCaretType       caretType);
  119.     
  120.     SelectionHandle NewDiscontiguousSelection(SelectionRanges *ranges);
  121.     
  122.     #ifdef __cplusplus
  123.     }
  124.     #endif
  125. #endif
  126.